<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>


	<%
	
		//1  读取cookie 看有没有
		
		Cookie[] cookies = request.getCookies();
	
		if(cookies == null || cookies.length ==1){
	%>
	
			<form action="CookieController.action">
	
				用户名: <input  name="username" value="scott" />
				密码:  <input type="password"  name="password" value="123456" />
				
				
				<input type="checkbox" name="passLogin"  /> 1分钟之内免登陆
				
				
				<input type="submit" value="登陆" />
			
			
			</form>	
	<%
			
		}else{
			
			out.println("要去读取cookies<br/>");
				
			for(int index=0;index<cookies.length;index++){
				Cookie cookie= cookies[index];
				
				
				//username  password
				
				
				out.println("name="+cookie.getName() + ", value="+cookie.getValue() +"<br/>");
				
				
				//设置
				request.setAttribute(cookie.getName(), cookie.getValue());
				
				//如何发送请求?
				
			}
			
			request.getRequestDispatcher("CookieController.action").forward(request, response);
		}
	
	
	%>

	

</body>
</html>